package com.hl.learndagger;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import com.hl.learndagger.model.SearchBalanceModel;
import com.hl.learndagger.presenter.SearchPresenter;

public class MainActivity extends AppCompatActivity implements ISearchBalance{

    private EditText numberEdt;
    private EditText resultEdt;
    private TextView resultErrorEdt;


    private SearchPresenter searchPresenter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        numberEdt = (EditText) findViewById(R.id.number);
        resultEdt = (EditText) findViewById(R.id.result);
        resultErrorEdt = (TextView) findViewById(R.id.result_error);

        searchPresenter = new SearchPresenter(this,new SearchBalanceModel());
    }

    public void onClick(View view)
    {
        switch (view.getId())
        {
            case R.id.retrieve_and_show:

                break;
            case R.id.retrieve_not_show:

                break;
        }
    }


    @Override
    public void searchSuccessful(int balance) {
        resultEdt.setText(""+balance);
    }

    @Override
    public void searchFailure(String errorMsg) {
        resultErrorEdt.setText(errorMsg);
    }
}
